package com.sugar.subscribe.course.module.business.controller.admin.order.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;

import static com.sugar.subscribe.course.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

@Schema(description = "管理后台 - 订单新增/修改 Request VO")
@Data
public class OrderSaveReqVO {

    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1775")
    @NotNull(message = "订单编号不能为空")
    private Long id;

    @Schema(description = "教练ID", example = "18361")
    private Long coachId;

    @Schema(description = "上课日期", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "上课日期不能为空")
    @JsonSerialize(using = LocalDateSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    private LocalDate attendClassDate;

    @Schema(description = "上课地点ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22762")
    @NotNull(message = "上课地点ID不能为空")
    private Long venueId;

    @Schema(description = "教学分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "15019")
    @NotNull(message = "教学分类不能为空")
    @Size(min = 2, message = "请选择二级教学分类")
    private Long[] serviceIds;

    @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "开始时间不能为空")
    @JsonSerialize(using = LocalTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = "HH:mm")
    private LocalTime startTime;

    @Schema(description = "教学人数（字典：business_coach_service_people_count）", requiredMode = Schema.RequiredMode.REQUIRED, example = "19")
    @NotEmpty(message = "教学人数（字典：business_coach_service_people_count）不能为空")
    private String peopleCount;

    @Schema(description = "教学时间（字典：business_coach_service_time）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "教学时间（字典：business_coach_service_time）不能为空")
    private String serviceTime;

    @Schema(description = "雪板类型（字典：business_snowboard_type）", example = "1")
    private String snowboardType;

    @Schema(description = "滑行水平（字典：business_gliding_level）")
    private String businessGlidingLevel;

    @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @NotEmpty(message = "用户昵称不能为空")
    private String nickname;

    @Schema(description = "联络手机号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "联络手机号不能为空")
    private String mobile;

    @Schema(description = "备注", example = "随便")
    private String remark;
}